home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-05 | 627 b | 21 lines | [MATF/MATL] |
- function [P0,err,P] = fix2dim(G,P0,delta,max1)
- % [P0,err] = fix2dim(G,P0,delta,max1)
- % [P0,err,P] = fix2dim(G,P0,delta,max1)
- % Fixed point iteration for higher dimensions.
- % G is the vector function, input.
- % P0 is the starting vector, input.
- % delta is the tolerance for P0, input.
- % max1 is the maximum number of iterations, input.
- % P0 is the vector fixed point, output.
- % err is the error estimate for P0, output.
- % P is the matrix of iterations, output.
- P = P0;
- for k=1:max1,
- P1 = feval(G,P0);
- P = [P;P1];
- err = norm(P1-P0);
- relerr = err/(norm(P1)+eps);
- P0 = P1;
- if (err<delta)|(relerr<delta), break, end
- end
-